﻿using GalaSoft.MvvmLight.Ioc;
using TroubleshootingofBeanBagAssistant.Data;

namespace TroubleshootingofBeanBagAssistant.ViewModel
{
	public class ViewModelLocator
	{

		public ViewModelLocator()
		{


			SimpleIoc.Default.Register(() => new GrowlViewModel(), "Growl");
			SimpleIoc.Default.Register(() => new GrowlViewModel(MessageToken.GrowlDemoPanel), "GrowlWithToken");
			SimpleIoc.Default.Register(() => new GrowlViewModel(MessageToken.GrowlDemoPanel), "OptionsLogView");
			SimpleIoc.Default.Register<ListViewViewModel>();

			//SimpleIoc.Default.Register<CustomDirectiveWordViewModel>();

			//SimpleIoc.Default.Register<OptionsViewModel>();
			//SimpleIoc.Default.Register<AIHubPowerToysViewModel>();
			//SimpleIoc.Default.Register<ImageBrowserDemoViewModel>();


			//SimpleIoc.Default.Register<ChatBoxViewModel>();

			//SimpleIoc.Default.Register<LanguageInputViewModel>();

			//SimpleIoc.Default.Register<ExtendedMenuListModel>();

			SimpleIoc.Default.Register<ViewModelLocator>();


			//SimpleIoc.Default.Register<NavigateTabItemViewModel>();


		}


		//Lazy  为惰性初始化提供支持。
		public static ViewModelLocator Instance = new Lazy<ViewModelLocator>(() => (ViewModelLocator)System.Windows.Application.Current.TryFindResource(resourceKey: "Locator")).Value;
		//public static ViewModelLocator Instance = (ViewModelLocator)Application.Current.FindResource("Locator") ?? new ViewModelLocator();


		#region Vm

		public GrowlViewModel Growl => SimpleIoc.Default.GetInstance<GrowlViewModel>("Growl");
		public GrowlViewModel GrowlWithToken => SimpleIoc.Default.GetInstance<GrowlViewModel>("GrowlWithToken");

		//public LanguageInputViewModel InputElement => new();


		public static ListViewViewModel ListViewViewModel => SimpleIoc.Default.GetInstance<ListViewViewModel>();




		#endregion


	}
}
